package offer;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

public class offerII_0079 {
    public List<List<Integer>> subsets(int[] nums) {
        int len=nums.length;
        List<List<Integer>> result=new LinkedList<>();
        List<Integer> path=new ArrayList<>();
        search(0,nums,path,result);
        return result;
    }
    public void search(int index,int[] nums,List<Integer> path,List<List<Integer>> result){
        if(index==nums.length){
            result.add(new ArrayList<>(path));
            return;
        }
        path.add(nums[index]);
        search(index+1,nums,path,result);
        path.remove(path.size()-1);
        search(index+1,nums,path,result);
    }
}
